<template>
	<view>

		<view class="color-info">
			<view v-for="(item,index) in dataList" class="color-transverse-item"@click.stop="colorSelected(index)">
				<view :class="item.clicked==1?'color-user-card-clicked':'color-user-card'" >
					
					
					<!-- <image class="img" :class="'img-color'+item.id"   ></image> -->
					<image class="color-img" :src="item.colourImage||'@appstatic/img/my/appoint_img_small.png'"   ></image>
					
					
					
				</view>
				<view class="color-info-transverse">
					<view class="text-2">{{item.colorName}}</view>
					<view class="text-2">￥ <text class="before">{{item.colorPrice}}</text></view>
				</view>
			</view>
		</view>
		<view v-if="dataList.length==0">
			<view class='img-box'>
			  <image class='emptyImage' src='@appstatic/img/my/my_order_no_data.png'></image>
			  <view class='text'>暂无数据</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "carSeries",
		props: {
			colorList: {
				type: Array,
				default: () => {
					return []
				}
			}

		},
		data() {
			return {

			};
		},
		computed: {
			dataList: {
				get() {
					for (var i = 0; i < this.colorList.length; i++) {
						if (this.colorList[i].clicked == 1) {
							this.$emit('colorItem_watch',this.colorList[i])
						} 
					}
					return this.colorList
				},
				set(v) {

				}

			}
		},
		methods: {
			colorSelected: function(index) {
				for (var i = 0; i < this.dataList.length; i++) {
					if (index == i) {
						this.dataList[i].clicked = 1
						this.$emit('colorItem',this.dataList[i])
						
					} else {
						this.dataList[i].clicked = 0
					}
				
				}
		
			},
		 
		},
		options: {
			styleIsolation: 'shared'
		},
	}
</script>

<style lang='scss' scoped>
	.color-info {
		/* width: calc(100% - 60px); */
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: row;
		/* margin-left: 30px;
		margin-right: 30px; */
		flex-wrap: wrap;
	}

	.color-transverse-item {
		width: 50%;



	}

	.color-info-transverse {
		margin-left: calc(50% - 60px);
		width: 120px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		margin-top: 10px;
		margin-bottom: 30px;
	}

	.color-user-card-clicked {
		margin-left: calc(50% - 60px);
		width: 120px;
		margin-top: 20rpx;
		height: 45px;
		clip-path: polygon(15px 0, calc(100% - 15px) 0,

				100% 0px, 100% calc(100% - 15px),

				calc(100% - 15px) 100%, 0px 100%,

				0 calc(100% - 15px), 0 15px);

		background: linear-gradient(-45deg, #EA5404 10px, #00000000 0) bottom right,

			linear-gradient(45deg, #EA5404 0px, #00000000 0) bottom left,

			linear-gradient(135deg, #EA5404 10px, #00000000 0) top left,

			linear-gradient(-135deg, #EA5404 0px, #00000000 0) top right;

		background-size: 50% 51%;
		background-repeat: no-repeat;
		border: solid 3px #EA5404;


	}

	.color-user-card {
		margin-left: calc(50% - 60px);
		width: 120px;
		margin-top: 20rpx;
		height: 45px;
		clip-path: polygon(15px 0, calc(100% - 15px) 0,

				100% 0px, 100% calc(100% - 15px),

				calc(100% - 15px) 100%, 0px 100%,

				0 calc(100% - 15px), 0 15px);

		background: linear-gradient(-45deg, #00000000 10px, #00000000 0) bottom right,

			linear-gradient(45deg, #00000000 0px, #00000000 0) bottom left,

			linear-gradient(135deg, #00000000 10px, #00000000 0) top left,

			linear-gradient(-135deg, #00000000 0px, #00000000 0) top right;

		background-size: 50% 51%;
		background-repeat: no-repeat;
		border: solid 2px #00000000;


	}

	.color-img {
		width: 122px;
		    height: 47px;
		    -webkit-clip-path: polygon(15px 0px, 100% 0px, 100% 0px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0px 100%, 0 calc(100% - 15px), 0 15px);
		    clip-path: polygon(15px 0px, 100% 0px, 100% 0px, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0px 100%, 0 calc(100% - 15px), 0 15px);
		    position: relative;
		    top: -1px;
		    left: -1px;

	}

	.img-color1 {
		background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #FFFFFF 39.51%, rgba(255, 255, 255, 0) 100%), linear-gradient(180deg, rgba(0, 0, 0, 0) 55.09%, rgba(0, 0, 0, 0.13) 100%), #DEDEDE;
	}

	.img-color2 {
		background: linear-gradient(180deg, rgba(47, 47, 47, 0) 0%, #9C9C9C 39.51%, rgba(56, 56, 56, 0) 100%), linear-gradient(180deg, rgba(0, 0, 0, 0) 55.09%, rgba(0, 0, 0, 0.13) 100%), #1A1A1A;
	}

	.img-color3 {
		background: linear-gradient(180deg, rgba(227, 15, 15, 0) 0%, #FF8787 39.51%, rgba(227, 15, 15, 0) 100%), linear-gradient(180deg, rgba(142, 5, 5, 0) 55.09%, rgba(111, 9, 9, 0.55) 100%), #E30F0F;
	}

	.img-color4 {
		background: linear-gradient(180deg, rgba(0, 133, 255, 0) 0%, #A7D5FF 39.51%, rgba(0, 133, 255, 0) 100%), linear-gradient(180deg, rgba(0, 88, 169, 0) 55.09%, rgba(0, 84, 160, 0.28) 100%), #0085FF;
	}

	.img-color5 {
		background: linear-gradient(180deg, rgba(199, 247, 97, 0) 0%, #E8FFA8 39.51%, rgba(177, 255, 11, 0) 100%), linear-gradient(180deg, rgba(137, 201, 0, 0) 55.09%, rgba(134, 198, 0, 0.13) 100%), #A4E815;
	}

	.img-color6 {
		background: linear-gradient(180deg, rgba(234, 84, 4, 0) 0%, #FFB892 39.51%, rgba(234, 84, 4, 0) 100%), linear-gradient(180deg, rgba(200, 71, 2, 0) 55.09%, rgba(182, 70, 11, 0.13) 100%), #EA5404;
	}




	.text-1 {
		font-family: 'Arial';
		font-style: normal;
		font-weight: 700;
		font-size: 18px;
		line-height: 21px;
		display: flex;
		align-items: center;
		color: #3D3A3A;
	}

	.text-2 {
		font-family: 'Noto Sans CJK SC';
		font-style: normal;
		font-weight: 400;
		font-size: 14px;
		line-height: 21px;

		display: flex;
		align-items: center;

		color: #333333;

		opacity: 0.4;
	}


	.price {
		font-style: normal;
		font-weight: 400;
		font-size: 14px;
		line-height: 18px;
		display: flex;
		align-items: center;
		color: #3D3A3A;
	}


	.before:before {
		content: " ";
		white-space: pre;

	}
	
	.img-box {
	  width: 100vw;
	  /* margin-left: calc(50% - 150rpx); */
	  display: flex;
	  flex-direction: column;
	  align-items: center;
	}
	.emptyImage{
	  width: 300rpx;
	  height: 300rpx;
	  margin-top: 50px;
	}
	.text {
	  text-align: center;
	  font-size: 28rpx;
	  line-height: 5px;
	  color: #ADB0AE;
	}
</style>
